
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:massagist/views/mass_appbar.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../generated/l10n.dart';

class WebPage extends StatefulWidget {
  String path;
  // InfoPage(ScoreModelEntity model);
  WebPage({required this.path});

  @override
  State<WebPage> createState() => WebPageState();
}

class WebPageState extends State<WebPage> {
  late WebViewController controller;
  DateTime? _lastPressedTime;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setBackgroundColor(Colors.transparent)
      ..setNavigationDelegate(
        NavigationDelegate(
          onWebResourceError: (WebResourceError error) {
            print('WebView error: $error');
          },
        ),
      )
      ..loadRequest(Uri.parse(widget.path));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MassAppbar(title: S.current.MINE_PRIVACY_TEXT,),
      body: Container(
        child: WebViewWidget(controller: controller),
      ),
    );
  }

}